package com.xiaoran.service.service;

import com.xiaoran.rpc.api.OrderService;
import com.xiaoran.common.annotation.RpcService;
import com.xiaoran.common.utils.RpcException;
import org.springframework.beans.factory.annotation.Value;

@RpcService(cls = OrderService.class)
public class OrderServiceImpl implements  OrderService{

    @Value("${server.port}")
    private Integer serverPort;

    @Override
    public String getOrder(String userName, String orderNo) {
        if ("error".equalsIgnoreCase(userName)) {
            throw new RpcException("test exception! " + userName);
        }
        return String.format("Server(" + serverPort + "), Order Details => userName: %s, orderNo: %s", userName, orderNo);
    }
}
